<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.9.0">
    

    

    



    <meta charset="utf-8">
    
    
    
    <title>openlayers 样式渲染 | 奔跑的蜗牛 | 虚心若愚</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="gis,openlayers">
    <meta name="description" content="openlayers 样式渲染1. 样式渲染方式 ol.Feature.setStyle(style) 在每个Feature上设置响应的样式。  ol.layer.Vector.setStyle(style) 在图层设置样式   2. Feature.setStyle()要素设置样式在openlayers API中setStyle方法描述如下： Set the style for the feat">
<meta name="keywords" content="gis,openlayers">
<meta property="og:type" content="article">
<meta property="og:title" content="openlayers 样式渲染">
<meta property="og:url" content="http://windynature.oschina.io/2020/03/18/openlayers/openlayers样式渲染/index.html">
<meta property="og:site_name" content="奔跑的蜗牛">
<meta property="og:description" content="openlayers 样式渲染1. 样式渲染方式 ol.Feature.setStyle(style) 在每个Feature上设置响应的样式。  ol.layer.Vector.setStyle(style) 在图层设置样式   2. Feature.setStyle()要素设置样式在openlayers API中setStyle方法描述如下： Set the style for the feat">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2020-03-18T05:54:59.330Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="openlayers 样式渲染">
<meta name="twitter:description" content="openlayers 样式渲染1. 样式渲染方式 ol.Feature.setStyle(style) 在每个Feature上设置响应的样式。  ol.layer.Vector.setStyle(style) 在图层设置样式   2. Feature.setStyle()要素设置样式在openlayers API中setStyle方法描述如下： Set the style for the feat">
    
        <link rel="alternative" href="/atom.xml" title="奔跑的蜗牛" type="application/atom+xml">
    
    <link rel="shortcut icon" href="/blog/favicon.ico">
    <link rel="stylesheet" href="//unpkg.com/hexo-theme-material-indigo@1.5.2/css/style.css">
    <script>window.lazyScripts=[]</script>
</head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu" class="hide" >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/blog/img/timg.jpg)">
      <div class="brand">
        <a href="/blog/" class="avatar waves-effect waves-circle waves-light">
          <img src="/blog/img/user2.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">windy</h5>
          <a href="mailto:windynature@163.com" title="windynature@163.com" class="mail">windynature@163.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/blog/"  >
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/blog/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                归档
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/blog/tags"  >
                <i class="icon icon-lg icon-tags"></i>
                标签
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/blog/categories"  >
                <i class="icon icon-lg icon-th-list"></i>
                分类
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/WindyNature" target="_blank" >
                <i class="icon icon-lg icon-github"></i>
                Github
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://git.oschina.net/windynature" target="_blank" >
                <i class="icon icon-lg icon-mayun"></i>
                码云
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">openlayers 样式渲染</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header post-header">

    <div class="container fade-scale">
        <h1 class="title">openlayers 样式渲染</h1>
        <h5 class="subtitle">
            
                <time datetime="2020-03-18T05:54:38.403Z" itemprop="datePublished" class="page-time">
  2020-03-18
</time>


	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/blog/categories/openlayers/">openlayers</a></li></ul>

            
        </h5>
    </div>

    

</header>


<div class="container body-wrap">
    
    <aside class="post-widget">
        <nav class="post-toc-wrap" id="post-toc">
            <h4>TOC</h4>
            <ol class="post-toc"><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#openlayers-样式渲染"><span class="post-toc-text">openlayers 样式渲染</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#1-样式渲染方式"><span class="post-toc-text">1. 样式渲染方式</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#2-Feature-setStyle-要素设置样式"><span class="post-toc-text">2. Feature.setStyle()要素设置样式</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-4"><a class="post-toc-link" href="#Removal-of-ol-FeatureStyleFunction"><span class="post-toc-text">Removal of ol.FeatureStyleFunction</span></a></li></ol></li></ol></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#3-ol-layer-Vector-setStyle-矢量图层设置样式"><span class="post-toc-text">3. ol.layer.Vector.setStyle()矢量图层设置样式</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#4-源码分析"><span class="post-toc-text">4. 源码分析</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#4-1-在Feature-js中："><span class="post-toc-text">4.1 在Feature.js中：</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#4-2-在ol-layer-Vector-js中"><span class="post-toc-text">4.2 在ol/layer/Vector.js中</span></a></li></ol></li></ol></li></ol>
        </nav>
    </aside>
    
<article id="post-openlayers/openlayers样式渲染"
  class="post-article article-type-post fade" itemprop="blogPost">

    <div class="post-card">
        <h1 class="post-card-title">openlayers 样式渲染</h1>
        <div class="post-meta">
            <time class="post-time" title="2020年03月18日 13:54" datetime="2020-03-18T05:54:38.403Z"  itemprop="datePublished">2020-03-18</time>

            
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/blog/categories/openlayers/">openlayers</a></li></ul>



            
<span id="busuanzi_container_page_pv" title="文章总阅读量" style='display:none'>
    <i class="icon icon-eye icon-pr"></i><span id="busuanzi_value_page_pv"></span>
</span>


            

        </div>
        <div class="post-content" id="post-content" itemprop="postContent">
            <h1 id="openlayers-样式渲染"><a href="#openlayers-样式渲染" class="headerlink" title="openlayers 样式渲染"></a>openlayers 样式渲染</h1><h2 id="1-样式渲染方式"><a href="#1-样式渲染方式" class="headerlink" title="1. 样式渲染方式"></a>1. 样式渲染方式</h2><ol>
<li><p>ol.Feature.setStyle(style)</p>
<p>在每个Feature上设置响应的样式。</p>
</li>
<li><p>ol.layer.Vector.setStyle(style)</p>
<p>在图层设置样式</p>
</li>
</ol>
<h2 id="2-Feature-setStyle-要素设置样式"><a href="#2-Feature-setStyle-要素设置样式" class="headerlink" title="2. Feature.setStyle()要素设置样式"></a>2. Feature.setStyle()要素设置样式</h2><p>在openlayers API中<code>setStyle</code>方法描述如下：</p>
<p>Set the style for the feature. This can be a single style object, an array of styles, or a function that takes a resolution and returns an array of styles. If it is <code>null</code> the feature has no style (a <code>null</code> style). </p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody><tr>
<td><code>style</code></td>
<td><a href="http://openlayers.org/en/v4.6.5/apidoc/ol.style.Style.html" target="_blank" rel="noopener">ol.style.Style</a> | Array.&lt;[ol.style.Style]| <a href="http://openlayers.org/en/v4.6.5/apidoc/ol.html#.FeatureStyleFunction" target="_blank" rel="noopener">ol.FeatureStyleFunction</a> | <a href="http://openlayers.org/en/v4.6.5/apidoc/ol.html#.StyleFunction" target="_blank" rel="noopener">ol.StyleFunction</a></td>
<td>Style for this feature.</td>
</tr>
</tbody></table>
<p> 可以看到，<code>setStyle()</code>方法传入的参数有四种：</p>
<ol>
<li>一个<code>ol.style.Style</code>对象</li>
<li>一个包含<code>ol.style.Style</code>对象的数组</li>
<li><code>ol.FeatureStyleFunction</code>(openalyers 5以前，openlayer 5移除了<code>ol.FeatureStyleFunction</code>)</li>
<li><code>ol.StyleFunction</code></li>
</ol>
<p>在新的openlyers  5的api中移除了<code>ol.FeatureStyleFunction</code>，所以新的api中只包含了1,2,4三类参数。</p>
<h4 id="Removal-of-ol-FeatureStyleFunction"><a href="#Removal-of-ol-FeatureStyleFunction" class="headerlink" title="Removal of ol.FeatureStyleFunction"></a>Removal of ol.FeatureStyleFunction</h4><p>The signature of the vector style function passed to the feature has changed. The function now always takes the <code>feature</code> and the <code>resolution</code> as arguments, the <code>feature</code> is no longer bound to <code>this</code>.</p>
<p>Old code:</p>
<figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">feature.setStyle(function(resolution) &#123;</span><br><span class="line">  var text = this.get(&apos;name&apos;);</span><br><span class="line">  ...</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>

<p>New code:</p>
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line">feature.setStyle(<span class="function"><span class="keyword">function</span>(<span class="params">feature, resolution</span>) </span>&#123;</span><br><span class="line">  <span class="keyword">var</span> text = feature.get(<span class="string">'name'</span>);</span><br><span class="line">  ...</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>

<h2 id="3-ol-layer-Vector-setStyle-矢量图层设置样式"><a href="#3-ol-layer-Vector-setStyle-矢量图层设置样式" class="headerlink" title="3. ol.layer.Vector.setStyle()矢量图层设置样式"></a>3. ol.layer.Vector.setStyle()矢量图层设置样式</h2><p>对于矢量图层设置样式。在图层中的要素没有设置要素的情况下才会生效。api中对该方法的描述如下：</p>
<p>Set the style for features. This can be a single style object, an array of styles, or a function that takes a feature and resolution and returns an array of styles. If it is <code>undefined</code> the default style is used. If it is <code>null</code> the layer has no style (a <code>null</code> style), so only features that have their own styles will be rendered in the layer. See <a href="http://openlayers.org/en/v4.6.5/apidoc/ol.style.html" target="_blank" rel="noopener"><code>ol.style</code></a> for information on the default style. </p>
<p>可以看到，传入的参数与要素的设置样式的参数差不多，如果样式没有定义（<code>undefined</code>），则会使用默认的样式，如果样式为空（<code>null</code>）则只有在要素上设置样式才会在图层中渲染。</p>
<h2 id="4-源码分析"><a href="#4-源码分析" class="headerlink" title="4. 源码分析"></a>4. 源码分析</h2><p>源码分析以openlayers 5为例：</p>
<h3 id="4-1-在Feature-js中："><a href="#4-1-在Feature-js中：" class="headerlink" title="4.1 在Feature.js中："></a>4.1 在<code>Feature.js</code>中：</h3><figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * Set the style for the feature.  This can be a single style object, an array</span></span><br><span class="line"><span class="comment"> * of styles, or a function that takes a resolution and returns an array of</span></span><br><span class="line"><span class="comment"> * styles. If it is `null` the feature has no style (a `null` style).</span></span><br><span class="line"><span class="comment"> **/</span></span><br><span class="line">setStyle(style) &#123;</span><br><span class="line">    <span class="keyword">this</span>.style_ = style;</span><br><span class="line">    <span class="keyword">this</span>.styleFunction_ = !style ? <span class="literal">undefined</span> : createStyleFunction(style);</span><br><span class="line">    <span class="keyword">this</span>.changed();</span><br><span class="line">  &#125;</span><br></pre></td></tr></table></figure>

<p><code>createStyleFunction()</code> 作用是将给定的对象转为一个style function.</p>
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * Convert the provided object into a feature style function.  Functions passed</span></span><br><span class="line"><span class="comment"> * through unchanged.  Arrays of module:ol/style/Style or single style objects wrapped</span></span><br><span class="line"><span class="comment"> * in a new feature style function.</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">export</span> <span class="function"><span class="keyword">function</span> <span class="title">createStyleFunction</span>(<span class="params">obj</span>) </span>&#123;</span><br><span class="line">  <span class="keyword">if</span> (<span class="keyword">typeof</span> obj === <span class="string">'function'</span>) &#123; <span class="comment">//如果是一个function则直接返回</span></span><br><span class="line">    <span class="keyword">return</span> obj;</span><br><span class="line">  &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">    <span class="keyword">let</span> styles; <span class="comment">//style数组</span></span><br><span class="line">    <span class="keyword">if</span> (<span class="built_in">Array</span>.isArray(obj)) &#123;</span><br><span class="line">      styles = obj;</span><br><span class="line">    &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">      assert(obj <span class="keyword">instanceof</span> Style, <span class="number">41</span>);</span><br><span class="line">      styles = [obj];</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123; <span class="comment">//返回一个function</span></span><br><span class="line">      <span class="keyword">return</span> styles;</span><br><span class="line">    &#125;;</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h3 id="4-2-在ol-layer-Vector-js中"><a href="#4-2-在ol-layer-Vector-js中" class="headerlink" title="4.2 在ol/layer/Vector.js中"></a>4.2 在<code>ol/layer/Vector.js</code>中</h3><p><code>setStyle()</code></p>
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line">setStyle(style) &#123;</span><br><span class="line">    <span class="keyword">this</span>.style_ = style !== <span class="literal">undefined</span> ? style : createDefaultStyle;</span><br><span class="line">    <span class="keyword">this</span>.styleFunction_ = style === <span class="literal">null</span> ?</span><br><span class="line">      <span class="literal">undefined</span> : toStyleFunction(<span class="keyword">this</span>.style_); <span class="comment">//toStyleFunction 调用了Style.js中的toFunction</span></span><br><span class="line">    <span class="keyword">this</span>.changed();</span><br><span class="line"> &#125;</span><br></pre></td></tr></table></figure>

<p><code>ol/style/Style.js中的toFunction()</code>,可以看见这个方法与Feature.js中的<code>createStyleFunction</code>内容完全一样，也是将给定 的对象转换为style function。</p>
<figure class="highlight plain"><table><tr><td class="code"><pre><span class="line">export function toFunction(obj) &#123;</span><br><span class="line">  let styleFunction;</span><br><span class="line"></span><br><span class="line">  if (typeof obj === &apos;function&apos;) &#123;</span><br><span class="line">    styleFunction = obj;</span><br><span class="line">  &#125; else &#123;</span><br><span class="line">    let styles;</span><br><span class="line">    if (Array.isArray(obj)) &#123;</span><br><span class="line">      styles = obj;</span><br><span class="line">    &#125; else &#123;</span><br><span class="line">      assert(obj instanceof Style,41); </span><br><span class="line">      styles = [obj];</span><br><span class="line">    &#125;</span><br><span class="line">    styleFunction = function() &#123;</span><br><span class="line">      return styles;</span><br><span class="line">    &#125;;</span><br><span class="line">  &#125;</span><br><span class="line">  return styleFunction;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>可见不管在矢量图层中还是在要素中，对于设置的style都会转换为一个style function。另外在渲染器<code>ol/renderer/canvas/VectorLayer.js</code>的<code>prepareFrame()</code>方法中我们可以看到如下代码：</p>
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line"><span class="keyword">const</span> render = <span class="function"><span class="keyword">function</span>(<span class="params">feature</span>) </span>&#123;</span><br><span class="line">     <span class="keyword">let</span> styles;</span><br><span class="line">     <span class="keyword">const</span> styleFunction = feature.getStyleFunction() || vectorLayer.getStyleFunction();</span><br><span class="line">     <span class="keyword">if</span> (styleFunction) &#123;</span><br><span class="line">       styles = styleFunction(feature, resolution);</span><br><span class="line">     &#125;</span><br><span class="line">     <span class="keyword">if</span> (styles) &#123;</span><br><span class="line">       <span class="keyword">const</span> dirty = <span class="keyword">this</span>.renderFeature(</span><br><span class="line">         feature, resolution, pixelRatio, styles, replayGroup);</span><br><span class="line">       <span class="keyword">this</span>.dirty_ = <span class="keyword">this</span>.dirty_ || dirty;</span><br><span class="line">     &#125;</span><br><span class="line">   &#125;.bind(<span class="keyword">this</span>);</span><br></pre></td></tr></table></figure>

<p>从上面的代码可见，当矢量图层渲染要素的时候，先在要素上获取style function，如果要素没有则获取图层的style function对要素进行渲染。</p>

        </div>

        <blockquote class="post-copyright">
    <div class="content">
        
<span class="post-time">
    最后更新时间：<time datetime="2020-03-18T05:54:59.330Z" itemprop="dateUpdated">2020年3月18日 13:54</time>
</span><br>


        这里写留言或版权声明：<a href="/blog/2020/03/18/openlayers/openlayers样式渲染/" target="_blank" rel="external">http://windynature.oschina.io/2020/03/18/openlayers/openlayers样式渲染/</a>
    </div>
    <footer>
        <a href="http://windynature.oschina.io">
            <img src="/blog/img/user2.jpg" alt="windy">
            windy
        </a>
    </footer>
</blockquote>

        


        <div class="post-footer">
            
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/blog/tags/gis/">gis</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/blog/tags/openlayers/">openlayers</a></li></ul>


            
<div class="page-share-wrap">
    

<div class="page-share" id="pageShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://windynature.oschina.io/2020/03/18/openlayers/openlayers样式渲染/&title=《openlayers 样式渲染》 — 奔跑的蜗牛&pic=http://windynature.oschina.io/img/user2.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://windynature.oschina.io/2020/03/18/openlayers/openlayers样式渲染/&title=《openlayers 样式渲染》 — 奔跑的蜗牛&source=" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://windynature.oschina.io/2020/03/18/openlayers/openlayers样式渲染/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《openlayers 样式渲染》 — 奔跑的蜗牛&url=http://windynature.oschina.io/2020/03/18/openlayers/openlayers样式渲染/&via=http://windynature.oschina.io" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://windynature.oschina.io/2020/03/18/openlayers/openlayers样式渲染/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>



    <a href="javascript:;" id="shareFab" class="page-share-fab waves-effect waves-circle">
        <i class="icon icon-share-alt icon-lg"></i>
    </a>
</div>



        </div>
    </div>

    
<nav class="post-nav flex-row flex-justify-between flex-row-reverse">
  

  
    <div class="waves-block waves-effect next">
      <a href="/blog/2020/03/18/openlayers/openlayers加载ArcGIS自定义坐标系切片服务/" id="post-next" class="post-nav-link">
        <div class="tips">Next <i class="icon icon-angle-right icon-lg icon-pl"></i></div>
        <h4 class="title">openlayers加载ArcGIS自定坐标切片服务</h4>
      </a>
    </div>
  
</nav>



    

<div class="comments" id="comments">
    <div class="ds-thread" data-thread-key="openlayers/openlayers样式渲染" data-title="openlayers 样式渲染" data-url="http://windynature.oschina.io/2020/03/18/openlayers/openlayers样式渲染/"></div>
</div>
<script>
lazyScripts.push('//cdn.bootcss.com/marked/0.3.6/marked.min.js');

var duoshuoQuery = {short_name:'ysblog', theme: 'none'};
lazyScripts.push('//unpkg.com/hexo-theme-material-indigo@1.5.2/js/embed.min.js');


</script>










</article>



</div>

        <footer class="footer">
    <div class="top">
        
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        站点总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style='display:none'>
        站点总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


        <p>
            <span><a href="/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            <span>博客内容遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">知识共享 署名 - 非商业性 - 相同方式共享 4.0协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p>
            <span>Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a></span>
            <span>奔跑的蜗牛 &copy; 2015 - 2020</span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://windynature.oschina.io/2020/03/18/openlayers/openlayers样式渲染/&title=《openlayers 样式渲染》 — 奔跑的蜗牛&pic=http://windynature.oschina.io/img/user2.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://windynature.oschina.io/2020/03/18/openlayers/openlayers样式渲染/&title=《openlayers 样式渲染》 — 奔跑的蜗牛&source=" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://windynature.oschina.io/2020/03/18/openlayers/openlayers样式渲染/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《openlayers 样式渲染》 — 奔跑的蜗牛&url=http://windynature.oschina.io/2020/03/18/openlayers/openlayers样式渲染/&via=http://windynature.oschina.io" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://windynature.oschina.io/2020/03/18/openlayers/openlayers样式渲染/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/blog/', SHARE: true, REWARD: false };



</script>

<script src="//unpkg.com/hexo-theme-material-indigo@1.5.2/js/main.min.js"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="//unpkg.com/hexo-theme-material-indigo@1.5.2/js/search.min.js" async></script>






<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>





</body>
</html>
